package dao

import "adam2/internal/model"

type Real9OptimizeAccountDao interface {
	// 查询所有记录
	FindAll() model.Real9OptimizeAccountArray

	// 更新real9_o_account表的hold_stock_number、stock_assets、total_assets字段
	UpdateBeforeSell(holdStockNumber int, stockAssets float64, accountName string)

	// 更新real9_o_account表的hold_stock_number、stock_assets、capital_assets、total_assets、total_stamp_duty、total_registrate_fee_when_sell、total_commission_when_sell字段
	UpdateAfterSell(sellOrBuyStockNumber int, holdStockAssets float64, stockAssets float64, real9OptimizeAccount model.Real9OptimizeAccount)

	// 更新real9_o_account表
	UpdateAfterBuy(real9OptimizeAccount model.Real9OptimizeAccount, everyDate string, sellOrBuyStockNumber int, stockAssets float64, currentBuyOrSellStockAssets float64)

	// 根据账号名查询记录
	FindByAccountName(accountName string) model.Real9OptimizeAccount

	// 清空表
	TruncateTable()

	// 根据日期，从real9_o_account_log表中向real9_o_account表中插入记录
	InsertFromReal9OptimizeAccountLogByDate(date string)

	// 查询所有记录，并按照总资产降序排列
	FindAllOrderByTotalAssetsDesc() model.Real9OptimizeAccountArray
}
